#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
检查数据库中的图书数据
"""

import os
import sys

# 添加项目路径到Python路径
sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from app import app, db, Book

def check_books():
    """检查图书数据"""
    with app.app_context():
        # 获取前10本书
        books = Book.query.limit(10).all()
        
        print("检查图书数据:")
        print("=" * 50)
        
        for i, book in enumerate(books, 1):
            print(f"图书 {i}:")
            print(f"  标题: {book.title}")
            print(f"  封面图片: {book.cover_image}")
            print(f"  描述: {book.description}")
            print("-" * 30)

if __name__ == '__main__':
    check_books()